STEP 6: Now let's change the image to match our random number!

Using the Change Image tool allows us to match the dice image to the random number each time the loop runs!

  • In GRAPHICS, click on . Drag out Change Image and drop it INSIDE your loop.
  • Change the image label in the .load_image() command to "dice" + str(outcome)

Remember, str() temporarily treats the value outcome as a string, so it can be combined with the string "dice".

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)